package com.bdqn.ssm.controller;



import com.bdqn.ssm.entity.User;
import com.bdqn.ssm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class StudentController{
    @Autowired
    UserService userService;
    @RequestMapping("/info")
    public String findStudentById(Model model, User user) {

        Map<String,Object> map=new HashMap<String,Object>();
        String name=user.getName();
        map.put("name", "%"+name+"%");
        List<User> user1 =userService.findUser(map);
        model.addAttribute("user",user1);
        return "user";
    }
}

